﻿using MediatR;
using S.RBAC.Domain.Model;
using S.RBAC.Infrastructure.Interface;
using S.RBAC.Read.Api.Application.Command.JurisdictionCommand;

namespace S.RBAC.Read.Api.Application.CommandHandlers.JurisdictionHandler
{
    public class JurisdictionSelectCommandHandler : IRequestHandler<JurisdictionSelectCommand, Jurisdiction>
    {
        protected readonly IJurisdictionRepository _jurisdiction;

        public JurisdictionSelectCommandHandler(IJurisdictionRepository jurisdiction)
        {
            _jurisdiction = jurisdiction;
        }

        public async Task<Jurisdiction> Handle(JurisdictionSelectCommand request, CancellationToken cancellationToken)
        {
            return await _jurisdiction.GetJurisdiction(request.JurisdictionId);
        }
    }
}
